package com.hdrx.fundhelper.controller;

import com.hdrx.fundhelper.common.R;
import com.hdrx.fundhelper.dao.pojo.UserFundRelationship;
import com.hdrx.fundhelper.dao.vo.UserIncomeVO;
import com.hdrx.fundhelper.service.userFund.UserFundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: houdx
 * @description:
 * @date: 2023/6/19 15:15
 */
@RestController
@RequestMapping("/userFund")
@Api(tags = "用户持仓信息")
public class UserFundController {

    @Autowired
    UserFundService userFundService;

    @PostMapping("/addUserFund")
    @ApiOperation("新增用户持仓信息")
    public R addUserFund(@RequestBody UserFundRelationship userFundRelationship) {
        userFundService.addUserFund(userFundRelationship);
        return R.ok().message("add ok");
    }

    @GetMapping("/queryUserIncome")
    @ApiOperation("查询用户收益")
    public UserIncomeVO queryUserIncome(@RequestParam Integer id) {
        UserIncomeVO userIncomeVO = userFundService.queryUserIncome(id);
       return userIncomeVO;
    }
}
